import { createApp } from 'vue'
import './style.css'
import App from './App.vue'
import router from './router'
import pinia from './stores'
import { setRem } from '@/utils/rem';
import DialogPlugin from './utils/dialog';
import Orchestrator from "@/logic/audioOrchestrator";
import { useStore } from "@/stores/data";


setRem();
const app = createApp(App)
app.use(router)
app.use(pinia)
app.use(DialogPlugin)

const store = useStore();
window.store = store;
Orchestrator.init({
  getConfig: () => store.userConfig,
  getToken : () => localStorage.getItem("token") || "",
  onConfigUpdate: (cfg) => { store.userConfig = cfg || store.userConfig; },
  onLog: (...args) => console.log("[O]", ...args),
  autoConnectOnVisible: false,          // 默认关闭
  autoConnectIfEverConnected: true      // 默认开启
});

app.mount('#app')